﻿using System;
using System.Collections.Generic;
using System.Web.Mvc;
using Kazuku.Core.Models;

namespace Kazuku.Blogs {
	public class BlogsRegistration : ModuleRegistration {
		//context.Routes.Add(new Route("blogs", 
		//                             new RouteValueDictionary {
		//                                                        {"area", "Kazuku.Blogs"}, {"controller", "blogs"}, {"action", "Index"}
		//                             },
		//                             new RouteValueDictionary(),
		//                             new RouteValueDictionary {
		//                                                        {"area", "Kazuku.Blogs"}
		//                             },
		//                             new KazukuRouteHandler()));
		//context.Routes.Add(new Route("blogs/{slug}",
		//                             new RouteValueDictionary {
		//                                                        {"area", "Kazuku.Blogs"}, {"controller", "blogs"}, {"action", "ShowSlug"}
		//                             },
		//                             new RouteValueDictionary(),
		//                             new RouteValueDictionary {
		//                                                        {"area", "Kazuku.Blogs"}
		//                             },
		//                             new KazukuRouteHandler()));
		//context.Routes.Add(new Route("blogs/{action}/{id}",
		//                             new RouteValueDictionary {
		//                                                        {"area", "Kazuku.Blogs"}, {"controller", "blogs"}, {"action", "Index"}, {"id", ""}
		//                             },
		//                             new RouteValueDictionary(),
		//                             new RouteValueDictionary {
		//                                                        {"area", "Kazuku.Blogs"}
		//                             },
		//                             new KazukuRouteHandler()));
		//context.Routes.Add(new Route("blogs/{controller}/{action}",
		//                             new RouteValueDictionary {
		//                                                        {"area", "Kazuku.Blogs"}, {"controller", "blogs"}, {"action", "Index"}
		//                             },
		//                             new RouteValueDictionary(),
		//                             new RouteValueDictionary {
		//                                                        {"area", "Kazuku.Blogs"}
		//                             },
		//                             new KazukuRouteHandler()));
		
		public override void RegisterArea(AreaRegistrationContext context) {
			MapRoute(context, "blogs",
					 new { area = "Kazuku.Blogs", controller = "blogs", action = "Index" });
			MapRoute(context, "blogs/{slug}",
					 new { area = "Kazuku.Blogs", controller = "blogs", action = "ShowSlug" });
			MapRoute(context, "blogs/{action}/{id}",
					 new { area = "Kazuku.Blogs", controller = "blogs", action = "Index", id = "" });
			MapRoute(context, "blogs/{controller}/{action}",
					 new { area = "Kazuku.Blogs", controller = "blogs", action = "index" });

			RegisterTheViewsInTheEmbeddedViewEngine(GetType());
		}

		public override string AreaName {
			get { return "Kazuku.Blogs"; }
		}
	}
}
